# 练习 10.5：访客簿 编写⼀个 while 循环，提⽰⽤户输⼊其名字。收
# 集⽤户输⼊的所有名字，将其写⼊ guest_book.txt，并确保这个⽂件中
# 的每条记录都独占⼀⾏。
from pathlib import Path
guests = ''
while True:
    guest = input("输⼊名字:")
    if (guest == 'quit'):
        break
    else:
        guests += (guest + '\n')

file = Path("D:\dev\PythonProject\python_learning\chapter10.2\guest_book.txt")
file.write_text(guests, encoding='utf-8')
